﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="InsertUpdateDeleteGridViewSimpleWay.aspx.cs" Inherits="InsertUpdateDeleteGridViewSimpleWay" %><%@ Register assembly="DevExpress.Web.ASPxEditors.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:AITSMConnectionString %>" 
            SelectCommand="SELECT * FROM [tblCourses]" 
            DeleteCommand="DELETE FROM [tblCourses] WHERE [CoursesID] = @CoursesID" 
            InsertCommand="INSERT INTO [tblCourses] ([CoursesID], [CoursesName], [Description]) VALUES (@CoursesID, @CoursesName, @Description)" 
            UpdateCommand="UPDATE [tblCourses] SET [CoursesName] = @CoursesName, [Description] = @Description WHERE [CoursesID] = @CoursesID">
            <DeleteParameters>
                <asp:Parameter Name="CoursesID" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="CoursesID" Type="String" />
                <asp:Parameter Name="CoursesName" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="CoursesName" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="CoursesID" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <asp:GridView ID="GridView1" runat="server" 
            onrowupdating="GridView1_RowUpdating">
        </asp:GridView>
        
        <br />
        <dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" 
            CssFilePath="~/App_Themes/PlasticBlue/{0}/styles.css" CssPostfix="PlasticBlue" 
            DataSourceID="SqlDataSource2" KeyFieldName="id">
            <Columns>
                <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0">
                    <EditButton Visible="True">
                    </EditButton>
                    <NewButton Visible="True">
                    </NewButton>
                    <DeleteButton Visible="True">
                    </DeleteButton>
                </dx:GridViewCommandColumn>
                <dx:GridViewDataTextColumn FieldName="id" ReadOnly="True" VisibleIndex="1">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="name" VisibleIndex="2">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="SubjectName" VisibleIndex="3">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="hours" VisibleIndex="4">
                </dx:GridViewDataTextColumn>
            </Columns>
            <SettingsPager ShowDefaultImages="False">
                <AllButton Text="All">
                </AllButton>
                <NextPageButton Text="Next &gt;">
                </NextPageButton>
                <PrevPageButton Text="&lt; Prev">
                </PrevPageButton>
            </SettingsPager>
            <Settings ShowFilterRow="True" ShowGroupPanel="True" />
            <Images SpriteCssFilePath="~/App_Themes/PlasticBlue/{0}/sprite.css">
                <LoadingPanelOnStatusBar Url="~/App_Themes/PlasticBlue/GridView/gvLoadingOnStatusBar.gif">
                </LoadingPanelOnStatusBar>
                <LoadingPanel Url="~/App_Themes/PlasticBlue/GridView/Loading.gif">
                </LoadingPanel>
            </Images>
            <ImagesFilterControl>
                <LoadingPanel Url="~/App_Themes/PlasticBlue/Editors/Loading.gif">
                </LoadingPanel>
            </ImagesFilterControl>
            <Styles CssFilePath="~/App_Themes/PlasticBlue/{0}/styles.css" 
                CssPostfix="PlasticBlue">
                <Header ImageSpacing="10px" SortingImageSpacing="10px">
                </Header>
            </Styles>
            <StylesEditors>
                <CalendarHeader Spacing="11px">
                </CalendarHeader>
                <ProgressBar Height="25px">
                </ProgressBar>
            </StylesEditors>
        </dx:ASPxGridView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:Set10ConnectionString %>" 
            DeleteCommand="DELETE FROM [Faculty] WHERE [id] = @id" 
            InsertCommand="INSERT INTO [Faculty] ([id], [name], [SubjectName], [hours]) VALUES (@id, @name, @SubjectName, @hours)" 
            SelectCommand="SELECT * FROM [Faculty]" 
            UpdateCommand="UPDATE [Faculty] SET [name] = @name, [SubjectName] = @SubjectName, [hours] = @hours WHERE [id] = @id">
            <DeleteParameters>
                <asp:Parameter Name="id" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="id" Type="String" />
                <asp:Parameter Name="name" Type="String" />
                <asp:Parameter Name="SubjectName" Type="String" />
                <asp:Parameter Name="hours" Type="Int32" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="name" Type="String" />
                <asp:Parameter Name="SubjectName" Type="String" />
                <asp:Parameter Name="hours" Type="Int32" />
                <asp:Parameter Name="id" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
        
    </div>
    </form>
</body>
</html>
